package service.impl.v2;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import dao.v2.MemberLevelItemVOMapper;
import model.MemberLevelItemVO;
import model.MemberVO;
import service.v2.MemberItemService;
@Service
public class MemberItemServiceImpl implements MemberItemService {
	@Autowired
	private MemberLevelItemVOMapper dao;

	public MemberVO getCurMemberLevelUpInfo(String level, String history_total_ticket) {
		return dao.getCurMemberLevelUpInfo(level,history_total_ticket) ;
	}

	public String getRateByLevel(String level) {
		return dao.getRateByLevel(level);
	}

	@Override
	public List<MemberLevelItemVO> selectLevleList(String lang) {
		List<MemberLevelItemVO> levelList= dao.selectLevleList();
		for(int i=0; i<levelList.size(); i++){
			Double rate=Double.valueOf(levelList.get(i).getRate());
			levelList.get(i).setStr_msg("购物"+rate*10+"折体验券(一个月)");
		}
		return levelList;
	}

	@Override
	public String getMyLevleOrd(String member_id) {
		
		return dao.getMyLevleOrd(member_id);
	}

	@Override
	public List<MemberLevelItemVO> selectLevleListBySomeField(String id, String member_id) {
		List<MemberLevelItemVO> levelList= dao.selectLevleListBySomeField(id,member_id);
		for(int i=0; i<levelList.size(); i++){
			Double rate=Double.valueOf(levelList.get(i).getRate());
			levelList.get(i).setStr_msg("购物"+rate+"折体验券(一个月)");
		}
		return levelList;
	}

	@Override
	public int getStateBySomeField(String id, String member_id) {
		return dao.getStateBySomeField(id,member_id);
	}

	@Override
	public String getOrdBylevel(String level) {
		return dao.getOrdBylevel(level);
	}
}
